<!DOCTYPE html>
{extend name="common/application" /}
{block name="title"}<title>个人中心-申诉</title>{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="_CSS_/help.css" />
<link rel="stylesheet" type="text/css" href="_CSS_/complain.css"/>
<style>
.nodatas{text-align: center;padding: 100px 0;}
.nodatas img{display: inline-block;margin-top: 100px;margin-bottom: 20px;}
</style>
{/block}
<!-- 主体内容 -->
{block name="content"}


			<!-- 主体内容 -->
			<div class="main">
				<div class="mainBody normalBox clearfix">
					<!--左菜单-->
					<ul class="menuList fl">
						<li>
							<a class="menuItem dropBg" href="personal.html"><span class="icons icon-account"></span>账户管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="personal.html">个人资料</a>
								<a class="menuchildItem" href="certification.html">实名认证</a>
								<a class="menuchildItem" href="account.html">账户安全</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="order.html"><span class="icons icon-order"></span>我的订单</a>
							<div class="childMenu">
								<a class="menuchildItem" href="order.html">我的订单</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="collect_news.html"><span class="icons icon-collection"></span>我的收藏</a>
							<div class="childMenu">
								<a class="menuchildItem" href="collect_news.html">资讯收藏</a>
								<a class="menuchildItem" href="collect_course.html">课程收藏</a>
								<a class="menuchildItem" href="collect_products.html">商品收藏</a>
								<a class="menuchildItem" href="collect_stores.html">店铺收藏</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="address.html"><span class="icons icon-address"></span>地址管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="address.html">地址管理</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="judge.html"><span class="icons icon-evaluate"></span>评价管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="judge.html">评价管理</a>
							</div>
						</li>
						<li class="showChild">
							<a class="menuItem dropBg" href="complain.html"><span class="icons icon-price"></span>申述退款</a>
							<div class="childMenu">
								<a class="menuchildItem" href="complain.html">申述</a>
								<a class="menuchildItem activeMenu" href="refund_money.html">退款</a>
							</div>
						</li>
						<li class="bb0">
							<a class="menuItem dropBg" href="message.html"><span class="icons icon-news"></span>消息中心</a>
							<div class="childMenu">
								<a class="menuchildItem" href="message.html">消息中心</a>
							</div>
						</li>
					</ul>
					<!--右内容-->
					<div class="menuContent fr">
						<div class="menuConHeader">
							<!--面包屑导航-->
							<div class="breadcrumb">
								<p>当前位置：
									<a href="complain.html">申诉退款</a> &gt;
									<a class="curPage" href="javascript:;">退款</a>
								</p>
							</div>
						</div>
						<div class="menuConBody">
							<!--二次筛选-->
							<div class="sec_tab">
								<a class="secType active_01" href="javascript:;">全部<span></span></a>
								<a class="secType" href="javascript:;">未处理<span></span></a>
								<a class="secType" href="javascript:;">处理中<span></span></a>
								<a class="secType" href="javascript:;">已完成<span></span></a>
								<a class="secType" href="javascript:;">已驳回<span></span></a>
							</div>
							<table class="tableList" border="1">
								<thead>
									<tr>
										<th width="20%">订单编号</th>
										<th width="30%">退款金额</th>
										<th width="20%">申请时间</th>
										<th width="15%">退款状态</th>
										<th width="15%">操作</th>
									</tr>
								</thead>
								<tbody>

								</tbody>
							</table>
							<div class="nodatas hide">
								<img src="/static/web/images/nodatas01.png"/>
								<p>抱歉，暂无订单</p>
							</div>
							<div id="page"></div>
						</div>
					</div>
				</div>
			</div>
			<!-- 底部信息 -->
{/block}



{block name="js"}
		<script src="_P_/layer/layer.js"></script>

		<script type="text/javascript">
			$(document).ready(function(){

					get_list(1);


				/*二级导航*/
				$('.secType').on('click',function(){
					$('.secType').removeClass('active_01');
					$(this).addClass('active_01');
					get_list(1);
				});

			});
			function get_list(page){
				var value=$('.secType').index($('.secType[class="secType active_01"]'));
				var userinfo=$.cookie('userinfo');
				if(userinfo) {
					var user_login = $.base64.decode(userinfo).split(",");
					var user_uid = user_login[0];
					$.ajax({
						type: "get",
						url: "{:url('api/account/refund_list')}",
						data: {'uid': user_login[0], 'page': page, 'static': value},
						dataType: 'jsonp',
						success: function (msg) {
							if (msg.code == 200) {
								$("tbody").html("");
								if (msg.data.data.length !== 0) {
									var html='';
									for (var i = 0; i < msg.data.data.length; i++) {
										var price_num = number_format(msg.data.data[i].money, 2, ".", ",");
										html+= ' <tr class="items" num="' + msg.data.data[i].id + '">';
										html+='<td>' + msg.data.data[i].order + '</td>';
										html+='<td class="prices">￥' + price_num + '</td>';
										html+='<td>' + getMyDate(msg.data.data[i].time * 1000) + '</td>';
										if(msg.data.data[i].static==1){
											html+='<td>未处理</td>';
										}else if(msg.data.data[i].static==2){
											html+='<td class="during">处理中</td>';
										}else if(msg.data.data[i].static==3){
											html+='<td class="finished">已完成</td>';
										}else{
											html+='<td class="danger">已驳回</td>';
										}
										html+='<td><a class="goDetails" href="javascript:;">查看详情</a></td></tr>';

									}
									$("tbody").html(html);
									var count=0;
									for(var j=0;j<msg.data.num.length;j++){
										if(msg.data.num[j].static==1){
											$('.secType').eq(1).find('span').html(msg.data.num[j].num);
										}
										if(msg.data.num[j].static==2){
											$('.secType').eq(2).find('span').html(msg.data.num[j].num);
										}
										if(msg.data.num[j].static==3){
											$('.secType').eq(3).find('span').html(msg.data.num[j].num);
										}
										if(msg.data.num[j].static==4){
											$('.secType').eq(4).find('span').html(msg.data.num[j].num);
										}
										count +=msg.data.num[j].num;
									}
									$('.secType').eq(0).find('span').html(count);
									if (msg.data.count == 0) {
										$('#page').html('');
									} else {
										$('#page').html(msg.data.render);
										$("#pagination").delegate("a", "click", function () {
											var num = $(this).attr("num");
											if (num) {
												get_list(num);
											}
										});
									}
								} else {
									$('.nodatas').removeClass('hide');
									$('.tableList').css('display','none');
									$("#page").html('');
								}
								/*查看详情*/
								$('.goDetails').on('click',function(){
									var id=$(this).parents('.items').attr('num');
									$.ajax({
										type: "get",
										url: "{:url('api/account/refund_details')}",
										data: {id: id},
										dataType: 'jsonp',
										success: function (msg) {
											if (msg.code == 200) {
												var result;
												if(msg.data.static==4){
												result=msg.data.result;
												}else if(msg.data.static==3){
													result='已退款';
												}else{
													result='正在处理';
												}
												/*查看详情*/
													layer.open({
														type: 1,
														title: '查看详情',
														closeBtn: false,
														shadeClose: true,
														scrollbar: false,
														area: ['600px', '300px'],
														content: "<div class='forms' id='details'><div class='form-group'><label>订单编号：</label><span class='orderNumber'>"+msg.data.order+"</span></div><div class='form-group'><label>原因：</label><span>"+msg.data.problem+"</span></div><div class='form-group'><label>处理方：</label><span>"+msg.data.name+"</span></div><div class='form-group'><label>处理结果：</label><span>"+result+"</span></div></div>",
//				        btn: ['发送', '取消'],
														yes: function(index, layero) {
															//do something
															layer.close(index); //如果设定了yes回调，需进行手工关闭
														}
													});
											}
										}
									});

								});
							}
							if (msg.code == 1000) {
								$('.nodatas').removeClass('hide');
								$('.tableList').css('display','none');
								$("#page").html('');
							}
						}
					})
				}else{
					layer.msg('还未登录！', {icon: 51});
				}

			}
		</script>
{/block}
			